/**
 * Hunan Jiao Tai Technology Co., Ltd.
 * The code belongs to the company and can not be used in other ways
 * Created by the company's technical personnel.
 * Ownership is the responsibility of the company's technology department.
 **/

package com.shop.common.enums.pay;

import lombok.Getter;

import java.io.Serializable;

/**
 * 支付状态枚举类
 *
 **/
@Getter
public enum PayStatusEnum implements Serializable {

    /**
     * 超时
     */
    TIMEOUT(-2),

    /**
     * 失败
     */
    FAIL(-1),

    /**
     * 待支付
     */
    WAITING(0),

    /**
     * 成功
     */
    SUCCESS(1),
    ;

    private int value;

    PayStatusEnum(int value) {
        this.value = value;
    }

    public int getValue() {
        return this.value;
    }

    public static PayStatusEnum val(int key) {
        for (PayStatusEnum enumObj : PayStatusEnum.values()) {
            if(enumObj.value == key) {
                return enumObj;
            }
        }
        return null;
    }

}
